<template>
	<el-dialog v-model="state.dialogFormVisible" width="60%" :z-index="9" :before-close="cancelHandle">
		<template #header>
			<div class="custom-header">{{ state.isChakanFlag ? '查看' : state.isUpdateFlag ? '新增' : '编辑' }}</div>
		</template>
		<el-form ref="updateFormRef" :model="state.form" :rules="rules">
			<el-row>
				<el-col :span="16">
					<el-form-item prop="reportingUnit" label="填报单位" label-width="120px">
						<el-input v-model="state.form.reportingUnit" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="reportingDate" label="填报日期" label-width="120px">
						<el-date-picker
							v-model="state.form.reportingDate"
							type="date"
							format="YYYY-MM-DD"
							value-format="YYYY-MM-DD"
							:disabled="state.isChakanFlag"
						/>
					</el-form-item>
				</el-col>

				<el-col :span="8">
					<el-form-item prop="reportingLink" label="填报人" label-width="120px">
						<el-input v-model="state.form.reportingLink" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="linkTel" label="联系电话" label-width="120px">
						<el-input v-model="state.form.linkTel" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="linkEmail" label="联系人邮箱" label-width="120px">
						<el-input v-model="state.form.linkEmail" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="groupStandardName" label="标准名称" label-width="120px">
						<el-input v-model="state.form.groupStandardName" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="groupStandardNumber" label="团体标准编号" label-width="120px" :disabled="state.isChakanFlag">
						<div style="display: flex">
							<el-input v-model="state.form.groupStandardNumber" :disabled="state.isChakanFlag" />
							<el-button icon="Search" circle :disabled="state.isChakanFlag" @click="ttbzchaxun" />
						</div>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="issuedUnit" label="发布单位" label-width="120px">
						<el-input v-model="state.form.issuedUnit" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>

				<el-col :span="8">
					<el-form-item prop="releaseDate" label="发布日期" label-width="120px">
						<el-date-picker
							v-model="state.form.releaseDate"
							type="date"
							format="YYYY-MM-DD"
							value-format="YYYY-MM-DD"
							:disabled="state.isChakanFlag"
						/>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="implementationDate" label="实施日期" label-width="120px">
						<el-date-picker
							v-model="state.form.implementationDate"
							type="date"
							format="YYYY-MM-DD"
							value-format="YYYY-MM-DD"
							:disabled="state.isChakanFlag"
						/>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="firstEditorUnit" label="第一主编单位" label-width="120px">
						<el-input v-model="state.form.firstEditorUnit" autocomplete="off" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="secondEditorUnit" label="第二主编单位" label-width="120px">
						<el-input v-model="state.form.secondEditorUnit" autocomplete="off" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="thirdEditorUnit" label="第三主编单位" label-width="120px">
						<el-input v-model="state.form.thirdEditorUnit" autocomplete="off" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item prop="fourthEditorUnit" label="第四主编单位" label-width="120px">
						<el-input v-model="state.form.fourthEditorUnit" autocomplete="off" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item prop="participatingUnits" label="参编单位：(多个单位逗号隔开)" label-width="210px">
						<el-input v-model="state.form.participatingUnits" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
			</el-row>

			<el-row class="" style="margin-left: 120px">
				<el-col :span="8"> 在全国团体标准信息平台公开 </el-col>
				<el-col :span="8">
					<el-radio-group v-model="state.form.openPlatform" class="ml-4" :disabled="state.isChakanFlag">
						<el-radio :value="1">已公开</el-radio>
						<el-radio :value="0">未公开</el-radio>
					</el-radio-group>
				</el-col>
				<el-col :span="8">
					<el-input v-model="state.form.openPlatformRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin-left: 120px; margin-top: 15px; margin-bottom: 15px">
				<el-col :span="8"> 在全国工程建设标准化信息网公开 </el-col>
				<el-col :span="8">
					<el-radio-group v-model="state.form.publicizedNetwork" class="ml-4" :disabled="state.isChakanFlag">
						<el-radio :value="1">已公开</el-radio>
						<el-radio :value="0">未公开</el-radio>
					</el-radio-group>
				</el-col>
				<el-col :span="8">
					<el-input v-model="state.form.publicizedNetworkRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin-left: 120px">
				<el-col :span="8"> 在其他网站公开 </el-col>
				<el-col :span="8">
					<el-radio-group v-model="state.form.publicWebsites" class="ml-4" :disabled="state.isChakanFlag">
						<el-radio :value="1">已公开</el-radio>
						<el-radio :value="0">未公开</el-radio>
					</el-radio-group>
				</el-col>
				<el-col :span="8">
					<el-input v-model="state.form.publicWebsitesRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin-left: 120px">
				<el-col :span="4"> 采信情况 </el-col>
				<el-col :span="10">
					<el-checkbox v-model="state.form.acceptanceGjhy" label="" size="large" :disabled="state.isChakanFlag"> 被国家行业地方标准引用 </el-checkbox>
				</el-col>
				<el-col :span="10">
					<el-input v-model="state.form.acceptanceGjhyRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin-left: 120px">
				<el-col :span="4"> </el-col>
				<el-col :span="10">
					<el-checkbox v-model="state.form.acceptanceFlfg" label="Option 2" size="large" :disabled="state.isChakanFlag">
						被法律法规、政策文件引用
					</el-checkbox>
				</el-col>
				<el-col :span="10">
					<el-input v-model="state.form.acceptanceFlfgRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin-left: 120px">
				<el-col :span="4"> </el-col>
				<el-col :span="10">
					<el-checkbox v-model="state.form.acceptanceHt" label="Option 2" size="large" :disabled="state.isChakanFlag"> 合同采用 </el-checkbox>
				</el-col>
				<el-col :span="10">
					<el-input v-model="state.form.acceptanceHtRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin-left: 120px" :disabled="state.isChakanFlag">
				<el-col :span="4"> </el-col>
				<el-col :span="10">
					<el-checkbox v-model="state.form.acceptanceQt" label="Option 2" size="large" :disabled="state.isChakanFlag">
						其他：行业自律、会员适用、书面承诺等
					</el-checkbox>
				</el-col>
				<el-col :span="10">
					<el-input v-model="state.form.acceptanceQtRemark" autocomplete="off" :disabled="state.isChakanFlag" />
				</el-col>
			</el-row>

			<el-row style="margin: auto; width: 80%; border: 1px solid; padding: 20px">
				<el-col :span="24"><h3 style="text-align: center; margin-bottom: 15px">工程应用情况</h3></el-col>
				<el-col :span="12">
					<el-form-item prop="engineeringApplicationDTO.projectName" label="工程名称" label-width="80px">
						<el-input v-model="state.form.engineeringApplicationDTO.projectName" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item prop="engineeringApplicationDTO.constructionNumber" label="报建编号" label-width="80px">
						<el-input v-model="state.form.engineeringApplicationDTO.constructionNumber" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col>
					<el-form-item prop="engineeringApplicationDTO.applicationArea" label="应用部位" label-width="80px">
						<el-input v-model="state.form.engineeringApplicationDTO.applicationArea" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col>
					<el-form-item prop="engineeringApplicationDTO.applicationScale" label="应用规模" label-width="80px">
						<el-input v-model="state.form.engineeringApplicationDTO.applicationScale" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
				<el-col>
					<el-form-item label="备注" label-width="80px">
						<el-input v-model="state.form.engineeringApplicationDTO.remark" :disabled="state.isChakanFlag" />
					</el-form-item>
				</el-col>
			</el-row>

			<el-form-item prop="engineeringApplicationDTO.selfDeclaration" label=" " label-width="120px">
				<!-- <el-checkbox-group v-model="state.form.engineeringApplicationDTO.selfDeclaration">
                    <el-checkbox-group label="所公开信息由填报单位的自我声明公开，其真实性由填报单位负责。" size="large" />
                </el-checkbox-group> -->
				<!-- <input type="checkbox" v-model="state.form.engineeringApplicationDTO.selfDeclaration">
                &nbsp;&nbsp;所公开信息由填报单位的自我声明公开，其真实性由填报单位负责。 -->
				<el-checkbox
					v-model="state.form.engineeringApplicationDTO.selfDeclaration"
					label="所公开信息由填报单位的自我声明公开，其真实性由填报单位负责。"
					size="large"
				/>
			</el-form-item>

			<el-form-item v-if="state.isChakanFlag" label="历史修改意见" label-width="120px">
				<el-table :data="state.historyyijian" style="width: 100%">
					<el-table-column prop="approvalOpinion" label="历史意见" header-align="center" align="center" />
					<el-table-column prop="reviewer" label="审批人" header-align="center" align="center" />
					<el-table-column prop="approvalDate" label="日期" header-align="center" align="center" />
				</el-table>
			</el-form-item>
		</el-form>

		<template #footer>
			<span class="dialog-footer">
				<el-button v-if="!state.isChakanFlag" @click="sumbitHandle(updateFormRef, false)">暂存</el-button>
				<el-button v-if="!state.isChakanFlag" type="primary" @click="sumbitHandle(updateFormRef, true)">提交</el-button>
				<el-button type="info" @click="cancelHandle"> 关闭 </el-button>
			</span>
		</template>
	</el-dialog>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import type { FormInstance, FormRules, UploadProps, UploadRawFile } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import moment from 'moment'
// import { UploadFile } from '@/interface/declare'

// import { generateUUID } from '@/utils/tool'
// import { useDictionaryStore } from '@/store/modules/dictionary'
// const dictionaryStore = useDictionaryStore()
// const leibielist = dictionaryStore.getDictionaryByCode('T003')

import { groupStandardEIUpdateApi, groupStandardEIDetailApi, groupStandardEICodeInfoApi } from '@/api/group/index'
import jsPDF from 'jspdf'
// import { useUserStore } from '@/store/modules/user'
// const userStore = useUserStore()

// import {  filePreviewByName } from '@/api/sys/upload'

interface RuleForm {
	reportingUnit: String
	reportingDate: String
	reportingLink: String
	linkTel: String
	linkEmail: String
	groupStandardName: String
	groupStandardNumber: String
	issuedUnit: String
	releaseDate: String
	implementationDate: String
	firstEditorUnit: String
	engineeringApplicationDTO: {
		projectName: String
		constructionNumber: String
		applicationArea: String
		applicationScale: String
		selfDeclaration: String | Number
	}
}
const state = reactive({
	form: {
		reportingUnit: '',
		reportingDate: '',
		reportingLink: '',
		linkTel: '',
		linkEmail: '',
		groupStandardName: '',
		groupStandardNumber: '',
		issuedUnit: '',
		releaseDate: '',
		implementationDate: '',
		firstEditorUnit: '',
		secondEditorUnit: '',
		thirdEditorUnit: '',
		fourthEditorUnit: '',
		participatingUnits: '', // 多的时候逗号隔开
		openPlatform: 0,
		openPlatformRemark: '',
		publicizedNetwork: 0,
		publicizedNetworkRemark: '',
		publicWebsites: 0,
		publicWebsitesRemark: '',
		acceptanceGjhy: false,
		acceptanceGjhyRemark: '',
		acceptanceFlfg: false,
		acceptanceFlfgRemark: '',
		acceptanceHt: false,
		acceptanceHtRemark: '',
		acceptanceQt: false,
		acceptanceQtRemark: '',
		engineeringApplicationDTO: {
			projectName: '',
			constructionNumber: '',
			applicationArea: '',
			applicationScale: '',
			selfDeclaration: false,
			remark: ''
		},
		hasSubmit: false
	},
	dialogFormVisible: false,
	isUpdateFlag: false,
	checkedList: [],
	isChakanFlag: false, // 查看
	historyyijian: [], // 历史意见
	// 审核画面需要的
	isShowView: false,
	isAuditUpdate: false,
	statusList: [],
	isHistoryFlag: false
})
const mobileRegExp = /^1[3456789]\d{9}$/
const telValidator = (rule, value, callback) => {
	if (mobileRegExp.test(value)) {
		callback()
	} else {
		callback(new Error('手机号格式不正确'))
	}
}
const yesOrNoValidator = (rule, value, callback) => {
	if (!value) {
		callback(new Error('请勾选自我声明'))
	} else {
		callback()
	}
}
const updateFormRef = ref<FormInstance>()
const rules = reactive<FormRules<RuleForm>>({
	reportingUnit: [{ required: true, message: '请输入填报单位', trigger: 'blur' }],
	reportingDate: [{ required: true, message: '请选择填报日期', trigger: ['blur', 'change'] }],
	reportingLink: { required: true, message: '请输入填报人', trigger: ['blur', 'change'] },
	// linkTel: {required: true, message: '请输入填报电话',trigger: ['blur', 'change']},
	linkTel: [
		{ required: true, message: '请输入填报电话', trigger: ['blur', 'change'] },
		{ validator: telValidator, trigger: ['blur', 'change'] }
	],
	linkEmail: { type: 'email', required: true, message: '请输入填报邮箱', trigger: ['blur', 'change'] },
	groupStandardName: { required: true, message: '请输入团体标准名称', trigger: ['blur', 'change'] },
	groupStandardNumber: { required: true, message: '请输入团体标准编号', trigger: ['blur', 'change'] },
	issuedUnit: { required: true, message: '请输入发布单位', trigger: ['blur', 'change'] },
	releaseDate: { required: true, message: '请输入发布日期', trigger: ['blur', 'change'] },
	implementationDate: { required: true, message: '请输入实施日期', trigger: ['blur', 'change'] },
	firstEditorUnit: { required: true, message: '请输入第一主编单位', trigger: ['blur', 'change'] },
	engineeringApplicationDTO: {
		projectName: { required: true, message: '请输入工程名称', trigger: 'blur' },
		constructionNumber: { required: true, message: '请输入报建编号', trigger: 'blur' },
		applicationArea: { required: true, message: '请输入应用部位', trigger: 'blur' },
		applicationScale: { required: true, message: '请输入应用规模', trigger: 'blur' },
		selfDeclaration: [
			{ required: true, message: '请勾选自我声明', trigger: 'change' },
			{ validator: yesOrNoValidator, trigger: 'change' }
		]
	}
})

const emit = defineEmits(['refreshDataList'])
// checkbox问题 深copy
var newForm = {}
// ==============================================================
const init = (isUpdate: Boolean, row: any, isChakan: Boolean) => {
	if (isChakan) {
		// 查看
		state.isChakanFlag = isChakan
	}
	state.isUpdateFlag = isUpdate
	if (!isUpdate) {
		// 编辑或者新增
		state.isHistoryFlag = false
		detailMethods(row.id)
	}
	state.dialogFormVisible = true
}
// 审核发布新增-查看
const initSh = (isUpdate: Boolean, row: any, isShow: Boolean) => {
	statusListApi()
	if (isShow) {
		state.form['approvalopinion'] = {
			approvalOpinion: '',
			reviewer: '',
			approvalDate: ''
		}
		state.isShowView = true
		state.isHistoryFlag = true
		state.isAuditUpdate = false
		state.historyyijian = []
		console.log('查看')
	} else {
		state.form['applyStatus'] = ''
		state.isAuditUpdate = true
		state.isHistoryFlag = false
		state.historyyijian = []
		state.isShowView = false
		console.log('编辑、新增')
	}
	state.isUpdateFlag = isUpdate
	if (!isUpdate) {
		detailMethods(row.id)
	}
	state.dialogFormVisible = true
}
// 请求参数列表参数错误问题 录入采集
const delzd = () => {
	delete state.form['applyStatus']
	delete state.form['applyStatusValue']
	delete state.form['publishStatus']
	delete state.form['publishStatusValue']
	delete state.form['approvalOpinion']
	delete state.form['releasedStandardFile']
	// 详情接口中的engineeringApplication对象，新增、编辑、暂存、不需要
	delete state.form['engineeringApplication']
}
const delShenheAdd = () => {
	delete state.form['approvalOpinion']
	delete state.form['publishStatus']
	delete state.form['publishStatusValue']
	delete state.form['applyStatusValue']
	delete state.form['releasedStandardFile']
}
// 详情接口
const detailMethods = async (id: Number | String) => {
	var params = {
		id: id
	}
	await groupStandardEIDetailApi(params).then(res => {
		console.log('详情', res)
		Object.assign(state.form, res.data)
		state.form.engineeringApplicationDTO = {
			projectName: res.data.engineeringApplication.projectName,
			constructionNumber: res.data.engineeringApplication.constructionNumber,
			applicationArea: res.data.engineeringApplication.applicationArea,
			applicationScale: res.data.engineeringApplication.applicationScale,
			selfDeclaration: res.data.engineeringApplication.selfDeclaration ? true : false,
			remark: res.data.engineeringApplication.remark
		}
		state.form.acceptanceFlfg = res.data.acceptanceFlfg ? true : false
		state.form.acceptanceGjhy = res.data.acceptanceGjhy ? true : false
		state.form.acceptanceHt = res.data.acceptanceHt ? true : false
		state.form.acceptanceQt = res.data.acceptanceQt ? true : false

		if (state.isChakanFlag) {
			state.historyyijian.push(res.data.approvalOpinion)
		}
	})
}

const sumbitHandle = async (formEl: FormInstance | undefined, isFlag: Boolean) => {
	// console.log(state.isAuditUpdate)
	if (!formEl) {
		return
	}
	await formEl.validate((valid, fields) => {
		if (valid) {
			if (!state.isUpdateFlag) {
				delzd()
			}
			// delete state.form.engineeringApplicationDTO["remark"]
			delete state.form['projectName']
			newForm = JSON.parse(JSON.stringify(state.form))

			newForm.acceptanceGjhy = state.form.acceptanceGjhy ? 1 : 0
			newForm.acceptanceFlfg = state.form.acceptanceFlfg ? 1 : 0
			newForm.acceptanceHt = state.form.acceptanceHt ? 1 : 0
			newForm.acceptanceQt = state.form.acceptanceQt ? 1 : 0
			newForm.engineeringApplicationDTO.selfDeclaration = state.form.engineeringApplicationDTO.selfDeclaration ? 1 : 0

			newForm.reportingDate = state.form.reportingDate ? state.form.reportingDate + ' 00:00:00' : ''
			newForm.releaseDate = state.form.releaseDate ? state.form.releaseDate + ' 00:00:00' : ''
			newForm.implementationDate = state.form.implementationDate ? state.form.implementationDate + ' 00:00:00' : ''
			// console.log("最后提交的数据：", state.form)
			if (isFlag) {
				// 判断是暂存还是提交
				submitRecord()
			} else {
				zancun()
			}
		} else {
			console.log('提交错误', fields)
		}
	})
}
const zancun = async () => {
	state.form['hasSubmit'] = false
	newForm['hasSubmit'] = false
	// console.log("暂存数据", state.form)
	await groupStandardEIUpdateApi(newForm).then(res => {
		ElMessage.success({
			message: '操作成功',
			duration: 500
		})
		cancelHandle()
	})
}
const submitRecord = async () => {
	state.form['hasSubmit'] = true
	newForm['hasSubmit'] = true
	// console.log("提交数据", state.form)
	await groupStandardEIUpdateApi(newForm).then(res => {
		ElMessage.success({
			message: '操作成功',
			duration: 500
		})
		cancelHandle()
	})
}
const resetForm = () => {
	var lsform = {
		reportingUnit: '',
		reportingDate: '',
		reportingLink: '',
		linkTel: '',
		linkEmail: '',
		groupStandardName: '',
		groupStandardNumber: '',
		issuedUnit: '',
		releaseDate: '',
		implementationDate: '',
		firstEditorUnit: '',
		secondEditorUnit: '',
		thirdEditorUnit: '',
		fourthEditorUnit: '',
		participatingUnits: '', // 多的时候逗号隔开
		openPlatform: 0,
		openPlatformRemark: '',
		publicizedNetwork: 0,
		publicizedNetworkRemark: '',
		publicWebsites: 0,
		publicWebsitesRemark: '',
		acceptanceGjhy: false,
		acceptanceGjhyRemark: '',
		acceptanceFlfg: false,
		acceptanceFlfgRemark: '',
		acceptanceHt: false,
		acceptanceHtRemark: '',
		acceptanceQt: false,
		acceptanceQtRemark: '',
		engineeringApplicationDTO: {
			projectName: '',
			constructionNumber: '',
			applicationArea: '',
			applicationScale: '',
			selfDeclaration: false,
			remark: ''
		},
		hasSubmit: false
	}
	state.form = { ...lsform }
}
const cancelHandle = () => {
	updateFormRef.value?.resetFields() // 表单验证关闭
	resetForm() // resetFields初始化问题
	state.isUpdateFlag = false
	state.checkedList = []
	state.isChakanFlag = false
	state.historyyijian = []
	state.dialogFormVisible = false
	emit('refreshDataList')
}

// 团体标准信息和工程信息一起录入，但是需要在录入团体标准时进行校验，如果是已有标准，则自动带出标准信息
const ttbzchaxun = async () => {
	// console.log(state.isChakanFlag)
	if (state.form.groupStandardNumber && !state.isChakanFlag) {
		// console.log('可以操作')
		await groupStandardEICodeInfoApi({ groupStandardNumber: state.form.groupStandardNumber }).then(res => {
			// console.log(res.data)
			if (res.data && res.data.length == 1) {
				state.form.reportingUnit = res.data[0].reportingUnit
				state.form.reportingDate = res.data[0].reportingDate
				state.form.reportingLink = res.data[0].reportingLink
				state.form.linkTel = res.data[0].linkTel
				state.form.linkEmail = res.data[0].linkEmail
				state.form.groupStandardName = res.data[0].groupStandardName
				state.form.groupStandardNumber = res.data[0].groupStandardNumber
				state.form.issuedUnit = res.data[0].issuedUnit

				state.form.firstEditorUnit = res.data[0].firstEditorUnit
				state.form.secondEditorUnit = res.data[0].secondEditorUnit
				state.form.thirdEditorUnit = res.data[0].thirdEditorUnit
				state.form.fourthEditorUnit = res.data[0].fourthEditorUnit
				state.form.participatingUnits = res.data[0].participatingUnits
				state.form.openPlatform = res.data[0].openPlatform
				state.form.openPlatformRemark = res.data[0].openPlatformRemark

				state.form.publicizedNetwork = res.data[0].publicizedNetwork
				state.form.publicizedNetworkRemark = res.data[0].publicizedNetworkRemark

				state.form.publicWebsites = res.data[0].publicWebsites
				state.form.publicWebsitesRemark = res.data[0].publicWebsitesRemark
			} else if (res.data && res.data.length > 1) {
				ElMessage.warning('出现多条标准，请重新输入或者直接填写新的')
			} else {
				ElMessage.warning('查询不到对应的标准，请重新输入或者直接填写新的')
			}
		})
	} else {
		ElMessage.warning('请输入团体标准')
	}
}

// 单位组织表格 操作
// const handleSelectionChange = (val) => {
//     console.log("选择的数据：", val)
//     state.checkedList = val
// }
// const addDanwei = () => {
//     state.form.units.push({
//         id: generateUUID(), // 唯一id
//         orgName: "",
//         orgCode: "",
//         location: "",
//         legalPerson: "",
//         phoneNumber: "",
//         emailAddress: "",
//     })
// }
// const reduceDanwei = () =>{
//     if(state.checkedList.length == 0 ) {
//         ElMessage.warning('请选择数据')
//         return;
//     }
//     var newCheckedList = [...state.checkedList]
//     var oldUnits = [...state.form.units]
//     var newUnits = []
//     if(state.checkedList && state.checkedList.length>0) {
//         newUnits = oldUnits.filter(
//             (a) => !newCheckedList.some((b) => a.id === b.id)
//         )
//         // console.log(newUnits)
//         state.form.units = newUnits
//         state.checkedList = []
//     }
// }
// 状态类别
// const statusListApi = async () => {
//     await groupStandardStatusApi().then(res => {
//         state.statusList = res.data
//     })
//     // 只要通过的filter
//     var newStatusList = [...state.statusList]
//     state.statusList = newStatusList.filter(item => item.label.includes('通过'));
//     // console.log(state.statusList)
// }
defineExpose({
	init,
	initSh
})
</script>

<style scoped>
.dialog-footer {
    padding-bottom: 20px;
}
</style>
